<!DOCTYPE html>
<html >
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 200px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div>

    </div>
</body>
<script>
    let div = document.querySelector('div');

    function removeDiv(){
        console.log('时间到了，该走了');
        
    }
    div.addEventListener('click',e =>{
        setTimeout(removeDiv,3000);
    })
</script>
</html>